FROM python:3.9-slim

WORKDIR /app

# 安装系统依赖
RUN apt-get update && apt-get install -y \
    build-essential \
    libta-lib-dev \
    wget \
    && rm -rf /var/lib/apt/lists/*

# 安装TA-Lib
RUN pip install numpy && \
    wget http://prdownloads.sourceforge.net/ta-lib/ta-lib-0.4.0-src.tar.gz && \
    tar -xzf ta-lib-0.4.0-src.tar.gz && \
    cd ta-lib/ && \
    ./configure --prefix=/usr && \
    make && \
    make install && \
    cd .. && \
    rm -rf ta-lib-0.4.0-src.tar.gz ta-lib/

COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

COPY . .

# 初始化Qlib数据
RUN mkdir -p ~/.qlib/qlib_data/cn_data

# 设置时区
ENV TZ=Asia/Shanghai

CMD ["python", "src/app.py"] 